package com.aaa.mythread2;

public class MyThread2 implements Runnable{
    private int ticketnum=10;
    @Override
    public void run() {
        while(true){
            if(ticketnum>0){
                // Thread-0
                System.out.println(Thread.currentThread().getName()+"售出去一张票，剩余的票数是:"+ticketnum--);
            }
        }
    }


    public static void main(String[] args) {
        MyThread2 myThread = new MyThread2();
        Thread thread = new Thread(myThread,"t1");
        Thread thread2 = new Thread(myThread,"t2000000000");
        thread.setPriority(Thread.MAX_PRIORITY);// 100
        thread2.setPriority(Thread.MIN_PRIORITY);
        thread.start();
        thread2.start();
    }
}
